package com.itheima.homework;

/**
 * @Author 王加鑫
 * @Date 2021/4/26 19:56
 * @Version 1.0
 * 6、【编号：706】 定义猫类Cat。属性:毛的颜色color，品种breed。
 * 行为:吃饭eat()，抓老鼠catchMouse()
 * 定义狗类Dog。属性:毛的颜色color，品种breed。行为:吃饭()，看家lookHome()
 * 要求:​1.按照以上要求定义Cat类和Dog类,属性要私有,生成空参、有参构造，set和get方法
 * ​2.定义测试类,在main方法中创建该类的对象并给属性赋值(set方法或有参构造方法)​3.调用成员方法,打印格式如下:
 * 花色的波斯猫正在吃鱼.....
 * 花色的波斯猫正在逮老鼠....
 * 黑色的藏獒正在啃骨头.....
 * 黑色的藏獒正在看家.....
 */
public class Day07HomeWork06 {
    public static void main(String[] args) {
        Cat cat = new Cat("花色","波斯猫");
        cat.eat();
        cat.catchMouse();


        Dog dog = new Dog();
        dog.setBreed("藏獒");
        dog.setColor("黑色");
        dog.eat();
        dog.lookHome();

    }
}

class Cat{
    //毛发颜色
    private String color;
    //品种
    private String breed;

    public Cat() {
    }

    public Cat(String color, String breed) {
        this.color = color;
        this.breed = breed;
    }

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    public String getBreed() {
        return breed;
    }

    public void setBreed(String breed) {
        this.breed = breed;
    }

    /*
    吃饭
     */
    public void eat(){
        System.out.println(getColor() + "的" + getBreed() + "正在吃鱼.....");
    }

    /*
    抓老鼠
     */
    public void catchMouse(){
        System.out.println(getColor() + "的" + getBreed() + "正在逮老鼠....");
    }
}

class Dog{
    //毛发颜色
    private String color;
    //品种
    private String breed;

    public Dog() {
    }

    public Dog(String color, String breed) {
        this.color = color;
        this.breed = breed;
    }

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    public String getBreed() {
        return breed;
    }

    public void setBreed(String breed) {
        this.breed = breed;
    }

    /*
    吃饭
     */
    public void eat(){
        System.out.println( getColor() + "的" + getBreed() + "正在啃骨头.....");

    }

    public void lookHome(){
        System.out.println(getColor() + "的" + getBreed() + "正在看家.....");
    }
}
